package his.controller;

import his.entity.ConstantType;
import his.service.ConstantService;
import org.example.his.common.api.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/admin/const/")
public class ConstantTypeController {

    @Autowired
    private ConstantService constantService;

    @GetMapping("const_type/all")
    @ResponseBody
    public CommonResponse<List<ConstantType>> getall_consttypes()
    {

        return  constantService.getall_consttypes();
    }

    @GetMapping("const_type/search/{keyword}")
    @ResponseBody
    public CommonResponse<List<ConstantType>> get_consttypes_bycode(@PathVariable String keyword){
        return constantService.get_consttypes_bycode(keyword);
    }
}
